-
Notifications
You must be signed in to change notification settings - Fork 152
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Stepper accessibility fixes #4571
Conversation
Storybook staging is available at https://kiwicom-orbit-sarka-stepper-a11y.surge.sh |
Size Change: +103 B (+0.02%) Total Size: 459 kB
ℹ️ View Unchanged
|
Deploying orbit with Cloudflare Pages
|
packages/orbit-components/src/Stepper/StepperStateless/index.tsx
Outdated
Show resolved
Hide resolved
icons={iconStyles} | ||
title={titleIncrement} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking of changing this prop name from title
to ariaLabel
in ButtonPrimitive
and making it more specific, however, this would be (probably) BC. I searched where this prop is used and I've found it's used here.
I'm not sure if it makes sense to change this prop name, if it could be included within this PR or in a separate one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So your suggestion is to keep prop names in Stepper as titleIncrement
and titleDecrement
and change the prop on the ButtonPrimitive
from title
to ariaLabel
so the usage would be ariaLabel={titleIncrement}
?
But anyway, I think it's out of scope and this should be tackled when making Button
/ButtonPrimitive
accessible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, that wouldn't make sense. :D My suggestion was to rename aria attribute in ButtonPrimitive
(probably in a different PR) and also change titleIncrement
(titleDecrement
). I kept titleDecrement
(titleIncrement
) because of attribute naming in ButtonPrimitive.
As you said, I also think it's out of the scope of this PR, that's the reason why I didn't touch ButtonPrimitive at all.
aa7965f
to
b925e95
Compare
6640b0d
to
3f6ed58
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't leave comments for the aria-live related stuff as I think we shouldn't be adding it, but let's discuss that in the comment I posted.
Overall, by looking at the component, I am thinking if maybe we should connect the individual subcomponents so it's clear that they are connected. Looking at the usage, I found this example:
I guess we could add aria-labelledby
to the Stepper so it's possible to connect these categories to the individual Steppers? You added it to the documentation, but you didn't added it to the component.
Also, maybe we could add aria-controls
internally to the buttons to connect them with the displayed text? You again added it to the documentation and not the component, but I think this one could be added only internally to buttons/input and not as a prop to Stepper component. Maybe aria-controls
is not the best solution for this, maybe you have more information and suggestions.
WDYT?
packages/orbit-components/src/Stepper/StepperStateless/index.tsx
Outdated
Show resolved
Hide resolved
icons={iconStyles} | ||
title={titleIncrement} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So your suggestion is to keep prop names in Stepper as titleIncrement
and titleDecrement
and change the prop on the ButtonPrimitive
from title
to ariaLabel
so the usage would be ariaLabel={titleIncrement}
?
But anyway, I think it's out of scope and this should be tackled when making Button
/ButtonPrimitive
accessible.
|
||
The Stepper component has been designed with accessibility in mind. It can be used with keyboard navigation and includes properties that enhance the experience for users of assistive technologies. | ||
|
||
Although the `ariaLabel` and `ariaLive` props are optional for the Stepper (StepperStateless) component itself, it is recommended to fill them in to ensure that the component can be perceived by assistive technologies. This ensures that the Stepper (StepperStateless) component is accessible. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why didn't you add the same table as in the Seat Accessibility tab?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there's no specific reason why I added it as a section (as it's in some other components). but I agree we can have accessibility things only in accessibility tags.
docs/src/documentation/03-components/07-interaction/stepper/03-accessibility.mdx
Outdated
Show resolved
Hide resolved
/> | ||
``` | ||
|
||
The screen reader will announce stepper title (`Passengers number`) and buttons title (`Add a passenger`, `Remove a passenger`) once they are focused by screen reader. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it stepper title? I thought it's title of the input? From "stepper title" I would assume it's the title for the whole component, including the buttons and displayed text.
Will the screen reader first announce "Passengers number" and only then "Remove a passenger" and "Add a passenger"? It won't be "Remove a passenger", then "Passengers number" and then "Add a passenger"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, but maybe it should be value title
instead of input title
? Because we are referring to the number with value
name in the docs.
docs/src/documentation/03-components/07-interaction/stepper/03-accessibility.mdx
Show resolved
Hide resolved
ae01432
to
afe75c2
Compare
Adding |
15f0b14
to
de793bf
Compare
Storybook staging is available at https://kiwicom-orbit-sarka-stepper-a11y.surge.sh Playroom staging is available at https://kiwicom-orbit-sarka-stepper-a11y.surge.sh/playroom |
fce1b7e
to
d2dae24
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Key Issues
The children
prop is used as a function without type checking, which can lead to runtime errors if children
is not a function; add TypeScript typing and runtime validation to prevent this issue.
dc22ee6
to
f6dd372
Compare
packages/orbit-components/src/Stepper/StepperStateless/index.tsx
Outdated
Show resolved
Hide resolved
| :--------- | | ||
| `"small"` | | ||
| `"normal"` | | ||
| titleDecrement | `string \| (any => string)` | | Specifies `ariaLabel` property on decrement `Button`. | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, I am not sure about this change 🤔 Maybe it could be "Specifies title
property on decrement Button
, added as aria-label
attribute/value."
Or, at least, wouldn't it make more sense to say "...aria-label
attribute/value... "? As there is no prop called ariaLabel
on Button.
/> | ||
``` | ||
|
||
The screen reader will announce stepper title (`Passengers number`) and buttons title (`Add a passenger`, `Remove a passenger`) once they are focused by screen reader. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, but maybe it should be value title
instead of input title
? Because we are referring to the number with value
name in the docs.
docs/src/documentation/03-components/07-interaction/stepper/03-accessibility.mdx
Outdated
Show resolved
Hide resolved
docs/src/documentation/03-components/07-interaction/stepper/03-accessibility.mdx
Show resolved
Hide resolved
f6dd372
to
72957e0
Compare
</Stack> | ||
``` | ||
|
||
This example includes `ariaLabelledby` prop. In this case, `ariaLabelledBy` prop is prioritized over `ariaLabel`, so the screen reader will announce the value title (`Passengers`) and buttons title (`Add a passenger`, `Remove a passenger`) once they are focused by the screen reader. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This example includes `ariaLabelledby` prop. In this case, `ariaLabelledBy` prop is prioritized over `ariaLabel`, so the screen reader will announce the value title (`Passengers`) and buttons title (`Add a passenger`, `Remove a passenger`) once they are focused by the screen reader. | |
This example includes `ariaLabelledby` prop. In this case, `ariaLabelledBy` prop is prioritized over `ariaLabelValue`, so the screen reader will announce the value title (`Passengers`) and buttons title (`Add a passenger`, `Remove a passenger`) once they are focused by the screen reader. |
72957e0
to
5ace489
Compare
This Pull Request meets the following criteria:
For new components:
d.ts
files and are exported inindex.d.ts
Closes https://kiwicom.atlassian.net/browse/FEPLT-2195
This PR fixes these a11y violations:
✨
Description by Callstackai
This PR introduces accessibility fixes for the Stepper component, ensuring compliance with a11y standards by adding necessary ARIA attributes.
Diagrams of code changes
Files Changed
This PR includes files in programming languages that we currently do not support. We have not reviewed files with the extensions
.mdx
,.md
. See list of supported languages.